﻿<Window x:Class="HM.UI.Windows.Management.ManagePaymentsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Payments Management" SizeToContent="WidthAndHeight"
        MaxHeight="600">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <ToolBarTray Grid.Row="0">
            <ToolBar Template="{StaticResource twoButtonToolBar}" />
        </ToolBarTray>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="150" />
                </Grid.ColumnDefinitions>
                <TextBlock
                    Grid.Column="0"
                    Text="Tenant Name"
                    FontWeight="Bold"
                    Margin="10" />
                <TextBlock
                    Grid.Column="1"
                    Text="Amount"
                    FontWeight="Bold"
                    Margin="10" />
                <TextBlock
                    Grid.Column="2"
                    Text="Payment Date"
                    FontWeight="Bold"
                    Margin="10"/>
            </Grid>
            <ListBox
                Grid.Row="1"
                ItemsSource="{Binding Payments}"
                SelectedItem="{Binding SelectedPayment}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition Width="150" />
                            </Grid.ColumnDefinitions>
                            <TextBlock
                                Grid.Column="0"
                                Text="{Binding Tenant.Name}"
                                Margin="5" />
                            <TextBox
                                Grid.Column="1"
                                Text="{Binding Amount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="5" />
                            <DatePicker
                                Grid.Column="2"
                                SelectedDate="{Binding PaymentDate, StringFormat={}{0:d MMMM yyyy}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="5" />
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
</Window>
